$(function () {
    url = $.util.getRequestJson('/json/consumeManage.orderDetail.json');
    $.util.get(url, {billId: $.util.getRequest('id')}, function (data) {
        phone =data.data.phone;
        data.data.phone=phone.toString().substr(0,3)+"****"+phone.toString().substr(7)
        $('#orderDetail').form('load', data.data);
        $.util.applyLabel({
            element: '#commodityTd',
            category: 'list',
            data: data.rows
        });
        $('.commodity').click(function () {
            var commodityId = $($(this).find('input')[0]).val();
            findDetail(commodityId);
        });
    });
    //实时获取payCode的值并进行判断
    $('#payCode').bind('input propertychange', function() {
        var payCode = $('#payCode').val();
        var before = payCode.substring(0,1);
        //var last = payCode.substring(payCode.length-2,payCode.length+1);
        //var middle = payCode.substring(2,payCode.length-2);
        if(before == "D"){
            $('#expendScoreNum').attr("style","display:none;");
        }else{
            $('#expendScoreNum').removeAttr("style");
        }
    });
});

// 商品详情
function findDetail(id) {
    var title = "商品详情";
    var url = $.util.getRootPath() + '/page/productManage/productDetail.html?id=' + id;
    //url = id ? url + '?id=2&typeId=' + typeId : url;
    var dialog = $.easyui.showDialog({
        iconCls: "",
        title: title,
        width: 600,
        height: 400,
        maximizable: true,
        href: url,
        topMost: true,
        enableSaveButton: false,
        closeButtonText: '关闭'
    });
}